<?php
	include(ROOTPATH .'include'. DS .'protect.php');
	//include(ROOTPATH .'include'. DS .'checkUserLogin.php');
	include(ROOTPATH .'include'. DS .'initUser.php');
	$title = htmlShow($show['name']);
	include "header.php";
	
	$isLogin = isset( $user ) && $user -> id() != 0 ? true : false;
		
	
?>
<script type="text/javascript" src="<?php echo JS_PATH;?>task.js"></script>
</head>
<body>
<?php require('top.php'); ?>
<div class="pos">	
    <div class="contents">
		<?php require('nav.php'); ?>
        <h2 class="title"><?php echo $navigation -> getList();?> > <?php echo htmlShow($show['name']);?>
        	<?php if( $user -> powder() >=9 || ( $user -> powder() >=5 && $user -> id() == $show['user_id'] )){?>
            <span><a href="<?php echo WEB_ROOT_PATH;?>?option=taskAdd&id=<?php echo $idCode;?>"><?php echo lang_edit ; ?></a></span>
        	<?php }?>
        </h2>
        <div id="task">
        	<div class="box">
            	<div class="baseInfo">
                	<div class="thumb"><a class="beautyImg"><img src="<?php echo $task -> getTaskThumb($show['thumb']);?>" /></a></div>
                    <ul>
                    	<li class="title"><?php echo htmlShow($show['name']);?></li>
                        <li><span><?php echo lang_timeout;?></span>：<?php echo date('Y-m-d',strtotime($show['timeEnd']));?></li>
                        <li><span><?php echo lang_posted_by;?></span>：<a target="_blank" title="<?php echo htmlShow($userInfo['nickName']);?>(<?php echo htmlShow($userInfo['userName']);?>)" href="<?php echo urlRewrite('option=home&id='.$userInfo['id'])?>"><?php echo htmlShow($userInfo['nickName']);?></a></li>
                        <?php /*?><li><span><?php echo lang_contribute_amount;?></span>：<?php echo $total .' '.lang_piece ;?></li><?php */?>
                        <li><span><?php echo lang_status;?></span>：<?php if( $task -> isTimeout($show['timeEnd'],'') ){ ?><span class="stop"><?php echo lang_task_end;?></span><?php }else{ echo '<span class="going">'.lang_task_collect.'</span>'; }?></li>                    
                    </ul>
                </div>
                <hr />
                <div class="entries">
                    <ul>
                    
				<li class="highBig">投稿方法（只需三步）</li>
                    <li>第一步、在本网站 
                    <?php if( !$isLogin ){?>
                    	<a href="<?php echo urlRewrite('option=regMini')?>" openWidth="500" class="openWinReg" target="_blank">注册</a>并且<a class="openWin" href="<?php echo urlRewrite('option=loginMini')?>" target="_blank">登录</a>；
                    <?php }else{?>
                    	在本站登录 (已经登录);
                    <?php }?>
                    </li>
                    <li>第二步、点击“投稿”进入上传页面；</li>
                    <li>第三步、按照“任务描述”中的要求上传您的投稿作品，点击上传页面最下方的“提交”按钮。</li>
                    <li class="highBig">How to submit(3 steps)</li>
                    <li>Step1. 
                    
                    <?php if( !$isLogin ){?>
                    	<a href="<?php echo urlRewrite('option=regMini')?>" openWidth="500" class="openWinReg" target="_blank">Register</a> and <a class="openWin" href="<?php echo urlRewrite('option=loginMini')?>" target="_blank">Login</a> to this Website;
                    <?php }else{?>
                    	Login (Completed);
                    <?php }?>
                    </li>
                    <li>Step2. Click "Submit" and go to the upload page;</li>
                    <li>Step3. Following the instructions of "Task Detail", upload your files and click "Submit" on bottom of the upload page.</li>
                   </ul>
                   
                   <hr /> 
                   <div class="submitField">
                   <?php if( $task -> isTimeout($show['timeEnd'],'')){?>
                   <a class="submit disabled">任务过期,不能投稿</a>
                   <?php }elseif( $isLogin ){?>
                   <a class="submit" href="<?php echo urlRewrite('option=creatMedia&task_id='.$idCode)?>"><?php echo lang_submit; ?></a>
                   
                   <?php }else{?>
                   <a class="submit disabled"><?php echo lang_submit;?></a>
                   <?php }?>
                   </div>
                   <hr /> 
                   
<?php /*?>                   <div class="submitField">                
                	<h3><?php echo lang_immediately_contribute;?></h3>
                    <form action="./?option=taskAction&type=action&do=taskAttend" method="post" class="form" id="idCodeForm">
                    <?php
                    	if( $task -> isTimeout($show['timeEnd'],'') ){
					?>
                        <input type="text" class="text stop" value="<?php echo lang_task_timeout_can_not_upload;?>" readonly="readonly" disabled="disabled" />
                    <?php }else{ ?>
                        <form action="./?option=" method="post" class="form" id="idCodeForm">
                        <ul>
                        <li><input type="text" class="text shiningTFD" id="idCode" name="idCode" value="<?php echo lang_works_identifier;?>" defaultVal="<?php echo lang_works_identifier;?>" /></li>                        
                        <li class="info"></li>
                        <li class="submits"><input type="submit" class="submit" value="<?php echo lang_submit;?>" /><input type="hidden" id="task_id" value="<?php echo $idCode;?>" /></li></ul>
                    <?php }?>
                    </form>
                    </div> <?php */?>
                    
                </div><!-- .entries-->
                
                
                
              <div class="explain">
                	<div class="highBig"><?php echo lang_task_description;?></div>
                    <p><?php echo htmlShow($show['description'],'<a><b><img><p><br>');?></p>
                    <hr />
                    <?php
						$files		 = explode('|',$show['file']);
						$fileTitles	 = explode(SPLIT_STRING,$show['fileTitle']);						
						$count = count($files);											
					?>
                    <?php if( $count == 0 ){?>
                    <h4 class="highBig"><?php echo lang_attachment;?></h4>
                    <strong><?php echo lang_task_download_title;?></strong>
                    <?php } ?>
                    <ul>
                    <?php
						for($i=0;$i < $count ; $i++){
							if( $files[0] == '') continue ;
							$type = getFileExt($files[$i]);
					?>
                   	  <li><a href="<?php echo urlRewrite('option=attachment&mediaType=task&id='.$idCode .'&page='. ($i+1) .'.'.$type) ;?>" target="_blank" title="<?php echo htmlShow($fileTitles[$i]) ;?>"><?php echo $i+1 ;?>: <?php echo htmlShow($fileTitles[$i].'.'.$type) ;?></a></li>                  
                    <?php
						}
                    ?>
                    </ul>
                    <hr />
                    <?php
						// 只有 超级管理官、管理员、任务发布人 可以任意时间查看。  其余人一律不能查看，包括用户。
						if( ( $user -> powder() >= 5 && $show['user_id'] == $user -> id()   )  ||   $user -> powder()  >= 9 ){
					?>                   	
                    	<h4 class="highBig"><?php echo lang_contribute_works;?></h4>
                    	<a class="submit" href="<?php echo WEB_ROOT_PATH .'?option=taskAttend&id='.$encrypt -> code($show['id']) ;?>"><?php echo lang_view?></a>
                    
                    <?php						
						}else{
							if( $task -> isTimeout($show['timeEnd'],'') ){
							?>
								<?php /*?>//<a class="submit" href="<?php echo urlRewrite('option=taskAttend&id='.$encrypt -> code($show['id']));?>"><?php echo lang_view?></a><?php */?>
					<?php ?>
								<?php /*?><a class="submit" href="<?php echo WEB_ROOT_PATH .'?option=taskAttend&id='.$encrypt -> code($show['id']) ;?>"><?php echo lang_view ?></a>                    <?php */?>
					<?php 	}else{ ?>
                            <input type="button" class="submit disabled" value="<?php echo lang_view?>" />                    
                            <div class="tips">只有当征集结束后您才可以查看投稿作品。</div>
                    <?php   }
					
							
						}
					
					
					?>
						
						
                    
                
              </div><!-- .explain-->
            	<div class="clear"></div>
            </div>
        
        </div><!--#task-->
	</div><!-- .contents-->
</div>

<?php require('footer.php'); ?>
</body>
</html>
